package com.shop.service.impl;

import com.shop.common.FileUtil;
import com.shop.common.result.Result;
import com.shop.common.result.util.ResultModel;
import com.shop.service.UploadService;
import com.shop.vo.UploadImageVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Slf4j
@Service
public class UploadServiceImpl implements UploadService {

    @Autowired
    private FileUtil fileUtil;

    @Override
    public ResultModel uploadImage(UploadImageVo uploadImageVo) throws Exception {
        return Result.successResultModel((Object)fileUtil.saveToLocalOrFtp(uploadImageVo.getFile(), true));
    }
}
